home *** CD-ROM | disk | FTP | other *** search
- '**************************************************************************
- '* MSSetup Toolkit Versions/VB
- '**************************************************************************
-
- '**************************************************************************
- '*
- '* Special notes:
- '*
- '* 1) The 3-D control stuff still does not work.
- '*
- '**************************************************************************
-
- ''$DEFINE DEBUG ''Define for script development/debugging
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- ''Windows API include stuff
- CONST WS_VISIBLE=&H10000000
- CONST WS_BORDER =&H00800000
- CONST WS_CLIPCHILDREN =&H02000000
- CONST GWL_STYLE =-16
- CONST SW_SHOWMAXIMIZED=3
-
- '' Declare Windows API functions
- DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%, iShow%) AS INTEGER
- DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
-
- '' Declare 3-D Control Library
- ''DECLARE FUNCTION Ctl3dRegister LIB "mscuistf.dll" (hInstance%) AS LONG
- ''DECLARE FUNCTION Ctl3dAutoSubclass LIB "mscuistf.dll" (hInstance%) AS LONG
- ''DECLARE FUNCTION Ctl3dUnRegister LIB "mscuistf.dll" (hInstance%) AS LONG
-
- ''Dialog ID's
- CONST WELCOME = 100
- CONST ASKQUIT = 200
- CONST DESTPATH = 300
- CONST EXITFAILURE = 400
- CONST EXITQUIT = 600
- CONST EXITSUCCESS = 700
- CONST APPHELP = 110
- CONST PATHHELP = 310
- CONST BADPATH = 6400
-
- CONST CDPREVINSTALL = 7100
- CONST CDCONFIRMINFO = 7300
- CONST CDGETNAMEORGSERIALNO = 7500
- CONST CDNAMEQ = 7700
- CONST CDORGREQ = 7800
- CONST CDSERIALREQ = 7900
-
- CONST BILLBOARDEASYTOUSE = 9000
- CONST BILLBOARDPOWERFULL = 9001
- CONST BILLBOARDCONFIGURABLE = 9002
- CONST BILLBOARDREGISTER = 9003
-
- ''Bitmap ID
- CONST LOGO = 1
-
- GLOBAL DEST$ ''Default destination directory.
-
- DECLARE SUB Install (sCustName$, sOrgName$, sSerialNo$)
- DECLARE FUNCTION MakePath (sDir$, sFile$) AS STRING
- DECLARE SUB UninstallPrevious (sDir$)
- DECLARE SUB RemovePrevInstalledFile (sDir$, sFile$)
-
- INIT:
- '' Register 3d library
- '' hInstance% = HinstFrame()
- '' i1&=Ctl3dRegister(hInstance%)
- '' i1&=Ctl3dAutoSubclass(hInstance%)
-
- ''Maximise frame window
- i1&=SetWindowLong(HwndFrame(), GWL_STYLE, WS_VISIBLE + WS_BORDER + WS_CLIPCHILDREN)
- j1%=ShowWindow(HwndFrame(), SW_SHOWMAXIMIZED)
-
- i% = SetSizeCheckMode(scmOff) '' could use scmOff; def = scmOnFatal
-
- CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
-
- SetBitmap CUIDLL$, LOGO
- SetTitle "VERSIONS/VB 1.1c Setup"
-
- sInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF sInf$ = "" THEN
- sInf$ = GetSymbolValue("STF_CWDDIR") + "VERSVB.INF"
- END IF
- ReadInfFile sInf$
-
- ''Setup billboard
- AddToBillboardList CUIDLL$, BILLBOARDEASYTOUSE, "FBillBoardEasyToUseDlgProc", 1
- AddToBillboardList CUIDLL$, BILLBOARDPOWERFULL, "FBillBoardPowerfullDlgProc", 1
- AddToBillboardList CUIDLL$, BILLBOARDCONFIGURABLE, "FBillBoardConfigurableDlgProc", 1
- AddToBillboardList CUIDLL$, BILLBOARDREGISTER, "FBillBoardRegisterDlgProc", 1
-
- DEST$ = "C:\VERSVB"
- AddSectionFilesToCopyList "system", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
-
- '$IFDEF DEBUG
- i% = SetSizeCheckMode(scmOnFatal) '' could use scmOff; def = scmOnFatal
- WinDrive$ = MID$(GetWindowsDir, 1, 1)
- IF IsDriveValid(WinDrive$) = 0 THEN
- i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
- GOTO QUIT
- END IF
- '$ENDIF ''DEBUG
-
-
- WELCOME:
- s$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
- IF s$ = "CONTINUE" THEN
- UIPop 1
- ELSE
- GOSUB ASKQUIT
- GOTO WELCOME
- END IF
-
- sCustName$ = ""
- sOrgName$ = ""
- sSerialNo$ = ""
- GETUSERNAME:
- if DoesFileExist(GetSymbolValue ("STF_SRCDIR")+"versvb.dat", femExists) then
-
- '' Check for a previously used disk and put up the legal warning dialog box.
- open GetSymbolValue ("STF_SRCDIR")+"versvb.dat" for input as #1
- line input #1, NameIn$
- line input #1, OrgIn$
- line input #1, SerialIn$
- close #1
-
- '' display previous name and organization information
- AddListItem "ConfirmTextIn", NameIn$
- AddListItem "ConfirmTextIn", OrgIn$
- AddListItem "ConfirmTextIn", SerialIn$
-
- result$=UIStartDlg ("mscuistf.dll", CDPREVINSTALL, "FConfirmDlgProc", APPHELP, HELPPROC$)
- if result$="CONTINUE" then
- UIPop 1
- else
- goto ASKQUIT
- end if
- sCustName$ = NameIn$
- sOrgName$ = OrgIn$
- sSerialNo$ = SerialIn$
- else
- GetOrgNameSerialNo:
- '' Obtain name and organization information
- SetSymbolValue "sCustName", sCustName$
- SetSymbolValue "sOrgName", sOrgName$
- SetSymbolValue "sSerialNo", sSerialNo$
-
- result$=UIStartDlg ("mscuistf.dll", CDGETNAMEORGSERIALNO, "FNameOrgSerialNoDlgProc", APPHELP, HELPPROC$)
- if result$="CONTINUE" then
- UIPop 1
- else
- goto ASKQUIT
- end if
-
- sCustName$=GetSymbolValue ("NameOut")
- sOrgName$=GetSymbolValue ("OrgOut")
- sSerialNo$=GetSymbolValue ("SerialOut")
-
- if sCustName$="" then
- result$ = UIStartDlg ("mscuistf.dll", CDNAMEREQ, "FNameOrgSerialNoDlgProc", APPHELP, HELPPROC$)
- UIPop 1
- goto GetOrgNameSerialNo
- endif
-
- if sOrgName$="" then
- result$ = UIStartDlg ("mscuistf.dll", CDORGREQ, "FNameOrgSerialNoDlgProc", APPHELP, HELPPROC$)
- UIPop 1
- goto GetOrgNameSerialNo
- endif
-
- if sSerialNo$="" then
- result$ = UIStartDlg ("mscuistf.dll", CDSERIALREQ, "FNameOrgSerialNoDlgProc", APPHELP, HELPPROC$)
- UIPop 1
- goto GetOrgNameSerialNo
- endif
-
- '' Display confirmation dialog
- SetSymbolValue "ConfirmTextIn", ""
- AddListItem "ConfirmTextIn", sCustName$
- AddListItem "ConfirmTextIn", sOrgName$
- AddListItem "ConfirmTextIn", sSerialNo$
-
- result$=UIStartDlg ("mscuistf.dll", CDCONFIRMINFO, "FConfirmDlgProc", APPHELP, HELPPROC$)
- UIPop 1
- if result$="BACK" then
- goto GetOrgNameSerialNo
- end if
-
- '' Save organization information to a file on disk 1.
- open GetSymbolValue ("STF_SRCDIR")+"versvb.dat" for output as #1
- print #1, sCustName$
- print #1, sOrgName$
- print #1, sSerialNo$
- close #1
- end if
-
- GETPATH:
- SetSymbolValue "EditTextIn", DEST$
- SetSymbolValue "EditFocus", "END"
- GETPATHL1:
- result$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", PATHHELP, HELPPROC$)
- DEST$ = GetSymbolValue("EditTextOut")
-
- IF result$ = "CONTINUE" THEN
- IF IsDirWritable(DEST$) = 0 THEN
- GOSUB BADPATH
- GOTO GETPATHL1
- END IF
- UIPop 1
- ELSEIF result$ = "REACTIVATE" THEN
- GOTO GETPATHL1
- ELSEIF result$ = "BACK" THEN
- UIPop 1
- GOTO GetOrgNameSerialNo
- ELSE
- GOSUB ASKQUIT
- GOTO GETPATH
- END IF
-
- Install sCustName$, sOrgName$, sSerialNo$
- UninstallPrevious DEST$
-
- if RestartListEmpty() = 0 then
- i% = ExitExecRestart()
- end if
-
-
- QUIT:
- ON ERROR GOTO ERRQUIT
-
- IF ERR = 0 THEN
- dlg% = EXITSUCCESS
- ELSEIF ERR = STFQUIT THEN
- dlg% = EXITQUIT
- ELSE
- dlg% = EXITFAILURE
- END IF
- QUITL1:
- result$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
- IF result$ = "REACTIVATE" THEN
- GOTO QUITL1
- END IF
- UIPop 1
- '' i1&=Ctl3dUnregister(hInstance%)
- END
-
- ERRQUIT:
- i% = DoMsgBox("Setup sources are corrupted, call StarBase Corporation at (714) 253-6700", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
- '' i1&=Ctl3dUnregister(hInstance%)
- END
-
-
-
- BADPATH:
- result$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
- IF result$ = "REACTIVATE" THEN
- GOTO BADPATH
- END IF
- UIPop 1
- RETURN
-
-
-
- ASKQUIT:
- result$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
- IF result$ = "EXIT" THEN
- UIPopAll
- ERROR STFQUIT
- ELSEIF result$ = "REACTIVATE" THEN
- GOTO ASKQUIT
- ELSE
- UIPop 1
- END IF
- RETURN
-
-
-
- '*************************************************************************
- '**
- '** Purpose:
- '** Builds the copy list and performs all installation operations.
- '** Arguments:
- '** sCustName$ - Custormer Name.
- '** sOrgName$ - Organization Name.
- '** sSerialNo$ - Product Serial Number.
- '** Returns:
- '** none.
- '**
- '*************************************************************************
- SUB Install (sCustName$, sOrgName$, sSerialNo$) STATIC
-
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
- CreateDir DEST$, cmoNone
-
- OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
- WriteToLogFile ""
- WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
- WriteToLogFile ""
- WriteToLogFile "May have had to create the directory: " + DEST$
- WriteToLogFile ""
-
- AddSectionFilesToCopyList "Files", SrcDir$, DEST$
- CopyFilesInCopyList
-
- stampstring$=CHR$(LEN(sCustName$))+sCustName$+CHR$(LEN(sOrgName$))+sOrgName$+CHR$(LEN(sSerialNo$))+sSerialNo$
- StampResource "system", "VersHookDll", GetWindowsSysDir(), 6, &H451, stampstring$, LEN(stampstring$)
- StampResource "Files", "VisDiffExe", DEST$, 6, &H451, stampstring$, LEN(stampstring$)
-
- CreateProgmanGroup "Versions/VB 1.1c", "", cmoNone
- ShowProgmanGroup "Versions/VB 1.1c", 1, cmoNone
- CreateProgmanItem "Versions/VB 1.1c", "Versions/VB 1.1c", MakePath(DEST$,"VERSVB.EXE"), "", cmoOverwrite
- CreateProgmanItem "Versions/VB 1.1c", "Versions/VB 1.1c Help", "WINHELP.EXE "+MakePath(DEST$,"VERSVB.HLP"), "", cmoOverwrite
- CreateProgmanItem "Versions/VB 1.1c", "Versions/VB 1.1c Visual Diff", MakePath(DEST$,"VISDIFF.EXE"), "", cmoOverwrite
- CreateProgmanItem "Versions/VB 1.1c", "Versions/VB 1.1c Visual Diff Help", "WINHELP.EXE "+MakePath(DEST$,"VISDIFF.HLP"), "", cmoOverwrite
- CreateProgmanItem "Versions/VB 1.1c", "Versions/VB 1.1c Release Notes", "WRITE.EXE "+MakePath(DEST$,"README.WRI"), "", cmoOverwrite
- CreateProgmanItem "Versions/VB 1.1c", "Versions/VB 1.1c Documentation Errata", "WRITE.EXE "+MakePath(DEST$,"ERRATA.WRI"), "", cmoOverwrite
- CloseLogFile
- END SUB
-
-
-
- '*************************************************************************
- '**
- '** Purpose:
- '** Appends a file name to the end of a directory path,
- '** inserting a backslash character as needed.
- '** Arguments:
- '** sDir$ - full directory path (with optional ending "\")
- '** sFile$ - filename to append to directory
- '** Returns:
- '** Resulting fully qualified path name.
- '**
- '*************************************************************************
- FUNCTION MakePath (sDir$, sFile$) STATIC AS STRING
- IF sDir$ = "" THEN
- MakePath = sFile$
- ELSEIF sFile$ = "" THEN
- MakePath = sDir$
- ELSEIF MID$(sDir$, LEN(sDir$), 1) = "\" THEN
- MakePath = sDir$ + sFile$
- ELSE
- MakePath = sDir$ + "\" + sFile$
- END IF
- END FUNCTION
-
-
-
-
- '*************************************************************************
- '**
- '** Purpose:
- '** Remove all previous installations if found.
- '** Arguments:
- '** sDir$ - full directory path
- '**
- '*************************************************************************
- SUB UninstallPrevious (sDir$) STATIC
- '' Remove previous 1.1 installation
- RemovePrevInstalledFile sDir$, "CVCMPREL.PIF"
- RemovePrevInstalledFile sDir$, "MSDNTB.DLL"
- RemovePrevInstalledFile sDir$, "README.TXT"
- RemovePrevInstalledFile sDir$, "VERS11.DLL"
- END SUB
-
-
-
-
- '*************************************************************************
- '**
- '** Purpose:
- '** Deletes the file sFile$ from the directory sDir$,
- '** if it exists.
- '** Arguments:
- '** sDir$ - full directory path (with optional ending "\")
- '** sFile$ - filename to be deleted
- '**
- '*************************************************************************
- SUB RemovePrevInstalledFile (sDir$, sFile$) STATIC
- dim sFullPath as string
-
- sFullPath = MakePath(sDir$, sFile$)
- if DoesFileExist(sFullPath, femExists) then
- RemoveFile sFullPath, cmoForce
- endif
- END SUB
-
-